using System;
using System.Collections.Generic;
using System.Text;
using Amazon.ECS;
/* Copyright 2008 Valentin Jacquemin

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

using System.Windows.Forms;

namespace Alexandrie.helper
{
    class LanguageHelper
    {
        /**
         * Retrieve the current store on which send the next requests
         *
         * @return AmazonECSLocale : the store (US,UK,FR,JP,DE,CA)
         */
        public static AmazonECSLocale getCurrentStore()
        {
            Plugin.Store store = Plugin.Store.com;
            try
            {
                store = (Plugin.Store)Enum.Parse(typeof(Plugin.Store), Plugin.plugin.getOptions().GetString("store", Plugin.Store.com.ToString()));
            }
            catch (ArgumentException e)
            {
                //no catch, too bad
            }
            switch (store)
            {
                case Plugin.Store.fr:
                    return AmazonECSLocale.FR;
                case Plugin.Store.com:
                    return AmazonECSLocale.US;
                case Plugin.Store.ca:
                    return AmazonECSLocale.CA;
                case Plugin.Store.de:
                    return AmazonECSLocale.DE;
                case Plugin.Store.jp:
                    return AmazonECSLocale.JP;
                case Plugin.Store.uk:
                    return AmazonECSLocale.UK;
                default:
                    throw new Exception("No store defined");
            }
        }
    }
}
